const buttonList = [{
		id: '9428fcd38b3d425aaa1749ca53d2819e',
		label: '发布',
		type: 'publish',
		icon: 'el-icon-s-promotion'
	},
	{
		id: '827fbb4894d34b9490e6645f54229c44',
		label: '修改链接',
		type: 'editlink',
		icon: 'el-icon-edit-outline'
	},
	{
		id: '827fbb62490d44fcb3bd645f54229c44',
		label: '下载资源',
		type: 'download',
		icon: 'el-icon-download'
	},
	{
		id: '38ed641c3e8d499797c8c762d94c8bce',
		label: '修改编目',
		type: 'catalog',
		icon: 'el-icon-tickets'
	},
	{
		id: 'fcdbc9ee7ff94a6dbbe0df429cdbeba3',
		label: '修改标签',
		type: 'label',
		icon: 'el-icon-collection-tag'
	},
	{
		id: '4844a3a324894d34b9490ee9a91467f6',
		label: '密级设置',
		type: 'secret',
		icon: 'el-icon-lock'
	},
	{
		id: '6afa987fd94342df9c680a43e5e92c4b',
		label: '分享资源',
		type: 'share',
		icon: 'el-icon-share'
	},
	{
		id: 'e3d0a2de48e5485aaa44faf0127f0ed7',
		label: '收藏资源',
		type: 'collect',
		icon: 'el-icon-collect'
	},
	{
		id: '6eff787864e049bfb4f999a1affd6fd1',
		label: '举报资源',
		type: 'inform',
		icon: 'el-icon-warning-outline'
	},
	{
		id: 'a28ea3fa64de4d368b3932cf314f2d80',
		label: '重命名',
		type: 'rename',
		icon: 'el-icon-edit'
	},
	{
		id: '2a175e4ac3cd4c0590353c727ab8bb4b',
		label: '移动到',
		type: 'move',
		icon: 'el-icon-rank'
	},
	{
		id: 'b9567ce1027347a4b10e76b104d245fe',
		label: '复制到',
		type: 'copy',
		icon: 'el-icon-document-copy'
	},
	{
		id: '2215f2c587bc4ef68d496f82cd7fe998',
		label: '删除资源',
		type: 'delete',
		icon: 'el-icon-delete'
	},
]
export default function contextMenuEvent(data, arr, callback) {
	let buttonArr = [];
	buttonList.forEach(item => {
		if (arr.some(n => n.buttonId === item.id)) {
			let icon = item.icon;
			let label = item.label;
			if (item.type === 'collect') {
				if (data.isCollect === '1') {
					label = '取消收藏';
					icon = 'el-icon-star-on';
				} else if (data.isCollect === '2') {
					label = '收藏';
					icon = 'el-icon-star-off';
				}
			}
			if (item.type === 'secret') {}
			if (data.isFolder === '1') {
				if (item.type !== 'download' && item.type !== 'inform') {
					buttonArr.push({
						label,
						icon,
						onClick: () => callback(data, item.type)
					})
				}
			} else {
				buttonArr.push({
					label,
					icon,
					onClick: () => callback(data, item.type)
				})
			}
		} else if (data.isLocal === '2' && item.type === 'editlink') {
			buttonArr.push({
				label: item.label,
				icon: item.icon,
				onClick: () => callback(data, item.type)
			})
		}
	})
	return buttonArr
}